const path = require("path");
const config = require("./config");
const exists = require("fs").existsSync;

module.exports = function options(dir) {
  const opts = getMetadata(dir);
  return opts;
};

// 读取本地模版的meta.js配置
function getMetadata(dir) {
  let opts = {};
  const js = path.join(dir, config.meta);
  if (exists(js)) {
    opts = require(path.resolve(js));
  }
  return opts;
}
